package com.training.java.core.homework04;

// Derived class that inherits Computer. Here upgrade() method is overridden.
public class Laptop extends Computer {

	// Variables
	private String serialNumber;

	// Methods
	public Laptop(String serialNumber) {
		super();
		this.serialNumber = serialNumber;
	}
	
	@Override
	public void upgrade(double maxMemory, double maxDiskCapacity) {
		if (super.getMaxMemory() + maxMemory >= 16) {
			maxMemory = 16;
		}
		if (super.getDiskCapacity() + maxDiskCapacity >= 300) {
			maxDiskCapacity = 300;
		}
		super.upgrade(maxMemory, maxDiskCapacity);
		System.out.println("laptop has been upgraded to, memory = "
				+ super.getMaxMemory() + " GB" + " disk capacity = "
				+ this.getDiskCapacity() + " GB");
	}

	// Getters
	public String getSerialNumber() {
		return serialNumber;
	}
}
